/** 
 * @author Huang RuiGuang
 * @date 2008/12/1
 *
 * Herm library
 * Copyright (c) 2008 by Huang RuiGuang(daemon.huang@gmail.com)
 *
 * Permission to use, copy, modify, distribute and sell this software.
 */

#ifndef HERM_FRAMEWORK_SOCK_BUFFER_H
#define HERM_FRAMEWORK_SOCK_BUFFER_H
#include <cstring>
#include "herm/base/container/buffer.h"

namespace herm{
	class Stream;
	class Datagram;
	class Address;
}

class StreamBuffer : public herm::Buffer
{
public:
	StreamBuffer(unsigned int size);
	~StreamBuffer();

	/**
     * @brief Receive from Stream.
	 */
	int Receive(herm::Stream& stream);

	/**
	 * @brief Send data by Stream.
	 * @param s, the source of data.
	 * @return true, succefully; false, the space of buffer is empty.
	 */
	bool Send(herm::Stream& stream);
};

/*
class DatagramBuffer : public herm::Buffer
{
public:
	DatagramBuffer(unsigned int size);
	~DatagramBuffer();

	int Receive(herm::Datagram& datagram);
	bool Send(herm::Datagram& datagram, const herm::Address& addr);
};*/

#endif
